package com.mcp.converter;

import com.mcp.converter.domain.rule.manager.RuleManager;
import com.mcp.converter.domain.rule.manager.impl.RuleManagerImpl;

import java.util.Set;

/**
 * 获取准确的不兼容函数数量
 */
public class GetExactFunctionCount {
    
    public static void main(String[] args) {
        RuleManager ruleManager = new RuleManagerImpl();
        Set<String> incompatibleFunctions = ruleManager.getAllIncompatibleFunctions();
        
        System.out.println("RuleManager中定义的不兼容函数总数: " + incompatibleFunctions.size());
        
        // 验证是否包含任何OceanBase支持的函数
        String[] oceanBaseSupportedSample = {
            "ABS", "CONCAT", "SYSDATE", "CAST", "DECODE", "SYS_CONTEXT", 
            "JSON_ARRAY", "XMLAGG", "AVG", "FIRST_VALUE"
        };
        
        boolean foundSupported = false;
        for (String func : oceanBaseSupportedSample) {
            if (incompatibleFunctions.contains(func)) {
                System.out.println("❌ 发现OceanBase支持的函数仍在不兼容列表中: " + func);
                foundSupported = true;
            }
        }
        
        if (!foundSupported) {
            System.out.println("✅ 抽样检查通过：OceanBase支持的函数都已正确移除");
        }
        
        // 验证是否包含确实不兼容的函数
        String[] shouldBeIncompatible = {
            "JSON_EXISTS", "REGEXP_LIKE", "LOCALTIME", "EMPTY_BLOB", 
            "CONNECT_BY_ROOT", "STANDARD_HASH"
        };
        
        int foundIncompatible = 0;
        for (String func : shouldBeIncompatible) {
            if (incompatibleFunctions.contains(func)) {
                foundIncompatible++;
            }
        }
        
        System.out.println("✅ 确实不兼容的函数检查: " + foundIncompatible + "/" + shouldBeIncompatible.length + " 个函数正确保留");
    }
}